import axios from 'axios';

export default {
    install: function(Vue, options) {

        let service = {
            // 查询符合条件的演出数量
            QueryShowsCount: (condition) => {
                return axios.post('/admin/show/query/count', condition);
            },

            // 查询符合条件的演出
            QueryShows: (condition, pageIndex, pageSize) => {
                return axios.post(`/admin/show/query?pageIndex=${pageIndex}&pageSize=${pageSize}`, condition);
            },

            // 导出演出列表
            ExportShows: (condition) => {
                return axios.post('/admin/show/export', condition)
                    .then(ret => {
                        var link = aphf.file.ADDR + '/' + ret;

                        var a = document.createElement("a");
                        a.download = 'Shows.xls';
                        a.href = link;
                        a.click();
                    })
            }
        }

        Vue.prototype.$ShowService = service;
    }
}